Repository navigation
id(serve): is_process_alive treats EPERM as alive (#2384) - #3420
Merged
Merged
Conversation
kill(pid, 0) failing was read as death, but EPERM means the process exists and is owned by another user — get_serve_info then deleted the live serve's .iroh-serve.lock and reported no serve running. Read the errno: alive iff the probe succeeds or errno is EPERM; ESRCH and other errnos stay dead. Mirrors mcpx ProcessAlive (pkgs/mcpx/internal/daemon/paths.go). The assert-nothing pid-1 test now asserts pid 1 reads as alive on Unix.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 13 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2384 (queue task 5262; routed by triage task 3552, CONFIRMED at main
f1eac954e).Problem:
is_process_alive(pkgs/id/src/commands/serve.rs) answeredkill(pid, 0) == 0and never read errno, so EPERM — process exists, owned by another user — read as dead.get_serve_infothen deleted the live serve's.iroh-serve.lockand returnedNone.Fix: read the errno on a failed probe — alive iff
kill(pid, 0) == 0or errno ==EPERM; ESRCH and other errnos stay dead. This mirrors the correct in-tree rule, mcpxProcessAlive(pkgs/mcpx/internal/daemon/paths.go). The assert-nothing pid-1 test now assertsis_process_alive(1)on Unix (pid 1 exists in every PID namespace; foreign-owned under unprivileged test runs, probe-successful as root — alive either way). Own-pid/dead-pid tests and the stale-lock behaviour for genuinely dead pids are unchanged; #2142's sentinel-pid case is untouched, as pinned.Verification: targeted
cargo test --lib test_is_process_aliverun on the laptop (fleet target dir) — see the task checkpoint / issue note for the result; the id CI workflow also exercises this crate.Need help on this PR? Tag
@codesmith-botwith what you need.